home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / audio / drive / Help.c++ < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  5.6 KB  |  195 lines

  1. /*
  2.  * Copyright 1992-1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #include "Help.h"
  18. #include <gl/gl.h>
  19. #include <gl/device.h>
  20. #include <fmclient.h>
  21.  
  22. #define TITLE_COL 0xFFFFFF
  23. #define TEXT_COL 0xFF00
  24.  
  25. static void draw_string(fmfonthandle font, char *s);
  26. static float xpos, ypos;
  27.  
  28. // draws the string at the current xpos and ypos
  29. // then updates ypos downward by a reasonable
  30. // amount.
  31. static void draw_string(fmfonthandle font, char *s)
  32. {
  33.     fmfontinfo font_info;
  34.     fmgetfontinfo(font, &font_info);
  35.     
  36.     long pixels_high = font_info.height;
  37.  
  38.     cmov2(xpos,ypos);
  39.     fmsetfont(font);
  40.     fmprstr(s);
  41.  
  42.     ypos -= 1.4*pixels_high;
  43. }
  44.  
  45. // draws help given window area in pixels
  46. void draw_help(long width, long height) 
  47. {
  48.     fmfonthandle font1, title, text;
  49.     float tmp, tmp2;
  50.  
  51.     font1 = fmfindfont("Hlv");
  52.     title = fmscalefont(font1, (float)width/70.0);
  53.     text = fmscalefont(font1, (float)width/80.0);
  54.     
  55.     cpack(0);
  56.     clear();
  57.  
  58.     ortho2(0,width,0,height);
  59.  
  60.     float top = height - height/15;
  61.     float col1 = width/20;
  62.     float col2 = width/3 + width/30;
  63.     float col3 = 2*width/3 + 2*width/20;
  64.  
  65.     xpos = col1;
  66.     ypos = top;
  67.  
  68.     cpack(TITLE_COL);
  69.     draw_string(title,"Welcome to Backseat Driver");
  70.     draw_string(text,"");
  71.  
  72.     cpack(TITLE_COL);
  73.     draw_string(title,"Car Controls");
  74.     cpack(TEXT_COL);
  75.     tmp = ypos;
  76.     draw_string(text,"Left-Right");
  77.     draw_string(text,"  Mouse Motion");
  78.     draw_string(text,"");
  79.     draw_string(text,"Right Mouse");
  80.     draw_string(text,"Middle Mouse");
  81.     draw_string(text,"");
  82.     draw_string(text,"A");
  83.     draw_string(text,"Z");
  84.     draw_string(text,"  or use");
  85.     draw_string(text,"1-2-3-4-5-N");
  86.     draw_string(text,"");
  87.     draw_string(text,"I");
  88.     tmp2 = ypos;
  89.  
  90.     ypos = tmp;
  91.     xpos = col1 + width/8;
  92.     draw_string(text,"Steering");
  93.     draw_string(text,"");
  94.     draw_string(text,"");
  95.     draw_string(text,"Gas");
  96.     draw_string(text,"Brakes");
  97.     draw_string(text,"");
  98.     draw_string(text,"Upshift");
  99.     draw_string(text,"Downshift");
  100.     draw_string(text,"");
  101.     draw_string(text,"");
  102.     draw_string(text,"");
  103.     draw_string(text,"Ignition");
  104.  
  105.     xpos = col1;
  106.     ypos = tmp2;
  107.     cpack(TITLE_COL);
  108.     draw_string(text,"");
  109.     draw_string(title,"Program Controls");
  110.     cpack(TEXT_COL);
  111.     tmp = ypos;
  112.     draw_string(text,"Esc");
  113.     draw_string(text,"R");
  114.     draw_string(text,"");
  115.     draw_string(text,"V");
  116.     draw_string(text,"G");
  117.     draw_string(text,"S");
  118.     draw_string(text,"D");
  119.  
  120.     ypos = tmp;
  121.     xpos = col1 + width/16;
  122.     draw_string(text,"Exit");
  123.     draw_string(text,"Reset Everything");
  124.     draw_string(text,"");
  125.     draw_string(text,"Toggle Driver/Helicopter View");
  126.     draw_string(text,"Toggle Fog (if available)");
  127.     draw_string(text,"Toggle Sound (if available)");
  128.     draw_string(text,"Toggle Draw Style");
  129.  
  130.     xpos = col2;
  131.     ypos = top;
  132.     cpack(TITLE_COL);
  133.     draw_string(title,"Helpful Hints");
  134.     cpack(TEXT_COL);
  135.     draw_string(text,"To start the engine, hold the gas and ignition");
  136.     draw_string(text,"simultaneously. Be sure you are in neutral.");
  137.     draw_string(text,"");
  138.     draw_string(text,"Beating your best lap time gives you more gas.");
  139.     draw_string(text,"");
  140.     draw_string(text,"Running without sound (using the S key");
  141.     draw_string(text,"or the -quiet option) will simultaneously");
  142.     draw_string(text,"increase graphics frame rate and please your");
  143.     draw_string(text,"office-mates.");
  144.     draw_string(text,"");
  145.     draw_string(text,"Running other CPU intensive programs");
  146.     draw_string(text,"may degrade the graphics frame rate and cause");
  147.     draw_string(text,"audio 'skipping.' Be sure to kill unwanted");
  148.     draw_string(text,"programs before running Backseat Driver.");
  149.     draw_string(text,"");
  150.     draw_string(text,"Driving way off the road or turning");
  151.     draw_string(text,"around and driving in the opposite direction");
  152.     draw_string(text,"will cause the display to become confused.");
  153.     draw_string(text,"This is a bug in Backseat Driver and will be");
  154.     draw_string(text,"fixed in a future release.");
  155.     draw_string(text,"");
  156.     draw_string(text,"Always drive defensively, wear your seatbelt,");
  157.     draw_string(text,"and never, ever drink and drive.");
  158.  
  159.     xpos = col3;
  160.     ypos = top;
  161.     cpack(TITLE_COL);
  162.     draw_string(title,"Author");
  163.     cpack(TEXT_COL);
  164.     draw_string(text,"Howard Look");
  165.     draw_string(text,"howardl @ sgi.com");
  166.  
  167.     cpack(TITLE_COL);
  168.     draw_string(text,"");
  169.     draw_string(title,"Tons of Help from");
  170.     cpack(TEXT_COL);
  171.     draw_string(text,"Alain Dumesney");
  172.     draw_string(text,"Bill Torzewski");
  173.     draw_string(text,"Dave Ligon");
  174.     draw_string(text,"Gary Tarolli");
  175.     draw_string(text,"Gavin Bell");
  176.     draw_string(text,"Gerald Anderson");
  177.     draw_string(text,"Gints Klimanis");
  178.     draw_string(text,"Jill Huchital");
  179.     draw_string(text,"John Giannandrea");
  180.     draw_string(text,"John Wilkinson");
  181.     draw_string(text,"Mason Woo");
  182.     draw_string(text,"Melissa Anderson");
  183.     draw_string(text,"Micah Altman");
  184.     draw_string(text,"Michael Toy");
  185.     draw_string(text,"Nick Thompson");
  186.     draw_string(text,"Paul Haeberli");
  187.     draw_string(text,"Paul Strauss");
  188.     draw_string(text,"Peter Broadwell");
  189.     draw_string(text,"Rikk Carey");
  190.     draw_string(text,"Rick Pasetto");
  191.     draw_string(text,"Rob Mace");
  192.     draw_string(text,"Vic Alessi");
  193. }
  194.  
  195.